package com.fubang.greendaolearning;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

/**
 * 创建者: YIN
 * 创建时间: 2017/8/4 9:48
 * 电子邮箱: yin_ruimin@foxmail.com
 * 描述:
 */

public class GlobalApplication extends Application {
    private DaoSession daoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(this, "note-db");
        SQLiteDatabase database = devOpenHelper.getWritableDatabase();
        daoSession = new DaoMaster(database).newSession();
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }
}
